package top.shen33.yang.base.util;

import java.io.UnsupportedEncodingException;
import java.util.Base64;

public class Base64Util {


    public static String decode(String str){

        byte[] bytes = Base64.getDecoder().decode(str);
        return new String(bytes);
    }
    public static String encode(String str){


        try {
            String text = Base64.getEncoder().encodeToString(str.getBytes("utf-8"));
            return text;
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "-1";
    }
}
